package com.book.print.api;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.security.oauth2.client.OAuth2RestOperations;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by wangxiangyun on 2018/8/31.
 */
@Controller
public class BookLogin {
    
    @Autowired
    private OAuth2RestOperations OAuth2RestTemplate;
    
    @GetMapping("/third/book")
    public String getClassicBook( ){
        ResponseEntity<String> responseEntity = OAuth2RestTemplate.getForEntity("http://localhost:8000/book/classical", String.class);
        return responseEntity.getBody();
    }
    
}
